#pragma once
#include <memory>
#include <vector>
#include "../XCom.h"
class XTask;
class XThread;
class XCOM_API XThreadPool
{
public:
    XThreadPool(){}
    virtual ~XThreadPool(){}
    virtual void init(int threadCount) = 0;
    // 禁止拷贝
    XThreadPool(const XThreadPool&)=delete;
    // 禁止
    XThreadPool& operator=(const XThreadPool&)=delete;
    virtual void dispatch(XTask* task) = 0;
    // 退出所有线程
    static void ExitAllThread();
    // 等待所有线程退出
    static void Wait();
};

class XCOM_API XThreadPoolFactory
{
public:
    static XThreadPool* Create();
};